package Zoo.View.LeaderView;

import Zoo.Entity.ZooparkEntity;
import Zoo.Handler.DeleteZooparkViewHandler;
import Zoo.View.LeaderView.LeaderView;

import javax.swing.*;
import java.awt.*;

/**
 * 1、DeleteZooparkView用于园长删除园区
 */
public class DeleteZooparkView extends JDialog {
    JPanel jPanel=new JPanel();

    JLabel idLable =new JLabel("删除的园区id");
    JTextField idTxt=new JTextField();

    JButton deleteBtn =new JButton("删除");

    DeleteZooparkViewHandler deleteZooparkViewHandler;
    public DeleteZooparkView(LeaderView leaderView){
        super(leaderView,"删除园区信息",true);

        deleteZooparkViewHandler=new DeleteZooparkViewHandler(this,leaderView);

//        LeaderService leaderService=new LeaderServiceImpl();
//        ZoomenEntity zoomenEntity=leaderService.getById(selectedZooparkId);

        idLable.setPreferredSize(new Dimension(80,30));
        jPanel.add(idLable);
        idTxt.setPreferredSize(new Dimension(200,30));
        jPanel.add(idTxt);


        Container contentPane=getContentPane();
        contentPane.add(jPanel);

        deleteBtn.addActionListener(deleteZooparkViewHandler);
        jPanel.add(deleteBtn);

        setSize(350,500);
        setLocationRelativeTo(null);
        //DISPOSE_ON_CLOSE：只销毁当前的窗体
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setResizable(false);
        setVisible(true);


    }

    //获取修改后的园区对象（但园区id是需要修改对象的园区id）
    public ZooparkEntity buildDeletedZooparkEntity() {
        ZooparkEntity zooparkEntity=new ZooparkEntity();
        zooparkEntity.setId(Integer.valueOf(idTxt.getText()));


        return zooparkEntity;
    }
}
